# -*- coding:utf-8 -*-
# @Time : 4/7/22 3:38 PM
# @Author :  rebeater
# @File : demo_save.py
# @Project:  PigViewer
# @Function: TODO

import numpy as np
import matplotlib.pyplot as plt
import pickle
plt.rcParams['xtick.direction'] = 'in'#将x周的刻度线方向设置向内
plt.rcParams['ytick.direction'] = 'in'#将y轴的刻度方向设置向内

def save_demo_fig(path):
    x = np.linspace(-np.pi, np.pi, 100)
    y = np.sin(x)
    fig = plt.figure("time",figsize=[6.4,4.8],dpi=200)
    plt.plot(x, y, color='#C3C3D9', ls=':', linewidth=2,marker="None")
    plt.xlabel("x")
    plt.ylabel("y")
    plt.title("title")
    plt.legend(["data"])

    with open(path, 'wb') as f:
        pickle.dump(fig, f)


if __name__ == '__main__':
    save_demo_fig("demo.pig")
